import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


public class Test {
	public static void main(String[] args) throws IOException {
		BufferedWriter writer1 = new BufferedWriter(new FileWriter("TEST_rewrite.txt"));
		writer1.write("THIS IS A TEST LINE");
		writer1.newLine();
		writer1.write("LINE2");
		writer1.newLine();
		writer1.close();
		/*BufferedWriter writer2 = new BufferedWriter(new FileWriter("TEST_rewrite.txt"));
		writer2.write("I WONDER IF THIS LINE IS ADDED");
		writer2.newLine();
		writer2.close();*/
		BufferedReader reader = new BufferedReader(new FileReader("TEST_rewrite.txt"));
		String curLine;
		while ((curLine=reader.readLine())!=null) {
			System.out.println(curLine);
		}
		reader.close();
	}
}
